XPort ETH XE Click
XPort ETH XE Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Jan 2025.
- Type : UART type
Software Support
Example Description
This example demonstrates the use of the XPort ETH XE Click board for Ethernet communication. The application initializes the XPort ETH XE module, retrieves essential information such as firmware version, MAC address, and network status, and demonstrates sending a ping command. It also allows for bidirectional UART communication between the USB UART and the XPort ETH XE UART.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.XPortETHXE
Example Key Functions
- xportethxe_cfg_setup This function initializes Click configuration structure to initial values.
void xportethxe_cfg_setup(xportethxe_cfg_t *cfg)
XPort ETH XE configuration object setup function.
XPort ETH XE Click configuration object.
Definition xportethxe.h:200
- xportethxe_init This function initializes all necessary pins and peripherals used for this Click board.
err_t xportethxe_init(xportethxe_t *ctx, xportethxe_cfg_t *cfg)
XPort ETH XE initialization function.
XPort ETH XE Click context object.
Definition xportethxe.h:177
- xportethxe_reset_device This function resets device by toggling the RST pin state.
void xportethxe_reset_device(xportethxe_t *ctx)
XPort ETH XE reset device function.
- xportethxe_send_cmd This function sends a command string by using UART serial interface.
void xportethxe_send_cmd(xportethxe_t *ctx, uint8_t *cmd)
XPort ETH XE send cmd function.
- xportethxe_send_enter This function sends enter (new line) by using UART serial interface.
void xportethxe_send_enter(xportethxe_t *ctx)
XPort ETH XE send enter function.
Application Init
Initializes the UART communication, logs essential information, configures the XPort ETH XE module, and retrieves the firmware version, MAC address, and network status. It also demonstrates basic command operations such as pinging the specific IP address (8.8.8.8).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, ">>> Reset Device to Monitor Mode <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Query Firmware Version <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get MAC Address <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get Network Status and IP Address <<<\r\n" );
log_printf( &logger, ">>> Send QU Command to Exit Monitor Mode and Connect to Listed <<<\r\n" );
log_printf( &logger, ">>> IP Address Through Web Browser to Access Web Interface <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Ping 8.8.8.8 and Switch to UART Terminal Commands Input <<<\r\n" );
xportethxe_read_response ( &xportethxe );
}
#define XPORTETHXE_CMD_QUERY_FW_VERSION
Definition xportethxe.h:123
#define XPORTETHXE_CMD_NET_STAT
Definition xportethxe.h:98
#define XPORTETHXE_CMD_MODE_MONITOR_WITH_NET
Definition xportethxe.h:75
#define XPORTETHXE_CMD_PING(ADR)
Definition xportethxe.h:99
#define XPORTETHXE_CMD_GET_MAC_ADDRESS
Definition xportethxe.h:96
#define XPORTETHXE_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition xportethxe.h:161
void application_init(void)
Definition main.c:85
#define MIKROBUS_POSITION_XPORTETHXE
Definition main.c:41
Application Task
Continuously reads data from the USB UART and forwards it to the XPort ETH XE module, while also capturing responses from the module and forwarding them back to the USB UART. This allows real-time interaction with the device through the UART Terminal for configuration and diagnostics.
{
if ( app_buf_len > 0 )
{
uart_write ( &xportethxe.uart, app_buf, app_buf_len );
xportethxe_clear_app_buf ( );
}
if ( app_buf_len > 0 )
{
uart_write ( &logger.uart, app_buf, app_buf_len );
xportethxe_clear_app_buf ( );
}
}
void application_task(void)
Definition main.c:142
#define PROCESS_BUFFER_SIZE
Definition main.c:46
Note
Ensure the XPort ETH XE Click board is properly connected to the network.
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.